<?php
//$intOrderHeaderID = 18;
if (defined("SITE")){
	$strSite = SITE;
	//$strSite.sprintf("%08d",$intOrderHeaderID)
}
include (MODULE_SHOP_HOST . "/navigation/EmailHeader");
include (MODULE . "/action/qrySelectOrderHeaderWithDetails");
unset($intTotal);
//STYLE='table-layout: fixed'
echo  "<link REL=stylesheet HREF='http://$SERVER_NAME/shop.css'>
	<table width='600' height='1000' align='center' class='Normal' border='0'  bgcolor='White'>
	<tr align='left' valign='top'>
		<td colspan='6'  width='600' height='100'><img src='http://".$SERVER_NAME."/images".SITE_SUFFIX."/EmailHeader.jpg' width='600' align='top' border='0'/></td>
	</tr>
	<tr>
		<td colspan='6' align='center'  height='70'>
			<h1 class='orderheading'>Accounts Copy</h1>
		</td>
	</tr>
	<tr>
		<td colspan='3' align='left' class='Normal' height='40'>
			<b>Order Number:</b> ".$strSite.sprintf("%08d",$intOrderHeaderID)."
		</td>
		<td colspan='3' align='right'  height='40'>
			<b>".date("j F Y ")."</b>
		</td>
	</tr>
	
	<tr height='10'>
		<td colspan='6'>
			<hr>
		</td>
	</tr>
	
	<tr>
		<td colspan='6' valign='top'>
			<table border='0' width='100%' class='Normal' cellpadding='3'>
				<tr>
					<td valign='top' height='170' align='left'>
			
						<br/><b>Tabernus Ltd</b>
						<br/>Lodge House
						<br/>Lodge Lane 
						<br/>Langham
						<br/>Colchester 
						<br/>CO4 5NE
						<br/>
						<br/>
						<b>Phone : </b>0844 41 42 970 
						<br/>
						<b>Fax : </b>0870 131 4474 
					</td>
				</tr>
			</table>
		</td>
	</tr>
	
	<tr height='10'>
		<td colspan='6'>
			<hr>
		</td>
	</tr>";
	/*
	
	<tr>
		<td colspan='6' valign='top' height='100'>
			<br/><b>Please Dispatch To:</b>
			<br/>".$myrow["DeliveryName"]."
			<br/>".$myrow["DeliveryAddress"];

				if ($myrow["DeliveryAddress2"]){
					echo "<br/>".$myrow["DeliveryAddress2"];
				}
		
echo "
			<br/>".$myrow["DeliveryCity"]."
			<br/>".$myrow["DeliveryRegion"]."
			<br/>".$myrow["DeliveryPostalCode"]."
			<br/>".$myrow["DeliveryPhone"]."
			<br/>
		</td>
	</tr>
	<tr height='20'>
		<td colspan='3' height='20'>
			<b>Type Of Dispatch :</b> ".DisplayLookupValue("tblCourier","Courier",$myrow[Courier])."
		</td>
		<td colspan='3'>
			&nbsp;
		</td>
	</tr>
	*/

	/*
	<tr align='center' height='20'>
        <td align='left' width='230'><b>Supplier Code</b></td>
		<td align='center' width='250' colspan='4'><b>".DOMAIN_NAME."<br/>Quantity Product Name & Code</b></td>
		<td align='right' width='120'>&nbsp;</td>
    </tr>
	*/
	echo "
	<tr>
		<td colspan='6' valign='top'>
			<table border='1' width='100%' class='Small' cellpadding='3'>
				<tr align='center' height='20'>
					<td align='left' width='90'><b>Supplier<br/>Code</b></td>
			        <td align='left' width='210'><b>Product</b></td>
					<td align='center' width='40' class='Small'><b>Unit Price ".CURRENCY."</b></td>
					<td align='center' width='30'><b>qty</b></td>
					<td align='right' width='40'><b>Net ".CURRENCY."</b></td>
					<td align='center' width='40'><b>VAT ".CURRENCY."</b></td>
					<td align='right' width='40'><b>Total ".CURRENCY."</b></td>
			    </tr>";

				
				// Process the order details
				//include (MODULE . "/action/qrySelectOrderDetails");
				do{
					echo "
					<tr align='right' bgcolor=\"".switch_background($boBG)."\">
						<td align='left' width='90'><b>".$myrow["SupplierProductID"]."</b></td>
				 		<td align='left' height='15'>";
						
								if ($myrow["QuantityPerUnit"]>1){
									echo $myrow["QuantityPerUnit"]."&nbsp;";
								}
								
							echo "<span class='Small'>".$myrow["Product"]."</span>
						</td>
						
						<td>".number_format($myrow["CostPrice"], 2, '.', '')."</td>
						<td>".$myrow["Quantity"]."</td>
						<td>".number_format($myrow["CostTotal"], 2, '.', '')."</td>
						<td>".number_format($myrow["CostTotalVAT"], 2, '.', '')."</td>
						<td>".number_format($myrow["CostTotalIncVAT"], 2, '.', '')."</td>
				    </tr>";
					$boBG = -1 - $boBG; //alternate $boBG values from -1 and 0
					$intTotal = number_format($intTotal + $myrow["CostPrice"], 2, '.', '');
					$intVatPayableTotal = number_format($intVatPayableTotal + $myrow["CostTotalVAT"], 2, '.', '');
					$intCostTotalTotal = number_format($intCostTotalTotal + $myrow["CostTotal"], 2, '.', '');
					$intCostTotalIncVAT = number_format($intCostTotalIncVAT + $myrow["CostTotalIncVAT"], 2, '.', '');
					$intVATRate = $myrow["VatRate"];
				} while ($myrow = mysql_fetch_array($result));
				
				
				
			echo "
				
				
				<tr  class='Normal'>
			 		<td colspan='4'  height='20'>Total</td>
					<td align='right'><b>".CURRENCY.number_format($intCostTotalTotal, 2, '.', '')."</b></td>
					<td align='right'><b>".CURRENCY.number_format($intVatPayableTotal, 2, '.', '')."</b></td>
					<td align='right'><b>".CURRENCY.number_format($intCostTotalIncVAT, 2, '.', '')."</b></td>
			    </tr>
				

			</table>
			
			<table border='1' width='100%' class='Normal'  cellpadding='3'>
			 <tr valign='top' height='60'>
			 	<td rowspan='2' class='small'>Date goods despatched</td>
			 	<td rowspan='1' class='small'>Were all goods despatched?</td>
				<td colspan='2' class='small'>If not, enter item not despatched</td>
				<td rowspan='1' class='small'>Royal Mail / Security Docket No</td>
			 </tr>
			 
			 <tr  valign='top'  height='60'>
			 	<!-- <td rowspan='2' class='small'>Date goods despatched</td> -->
			 	<td align='center' valign='middle'><b>YES/NO</b></td>
				<td class='small'>From</td>
				<td class='small'>To</td>
				<td rowspan='1' class='small'>Please attach copy</td>
			 </tr>
			
			</table>
			
			<table border='1' width='100%' class='small' cellpadding='3'>
			 <tr  valign='bottom'  height='60'>
			 	<td align='left' width='35%'>Signed<hr></td>
			 	<td align='left' width='30%'>Date<hr></td>
				<td align='left' width='35%'>Print Name<hr></td>
			 </tr>
			</table>
			
			<table border='1' width='100%' class='Normal' cellpadding='3'>
			 <tr  valign='MIDDLE'  height='60'>
			 	<td align='CENTER' width='35%'>
					<b>PLEASE ENSURE DATES AND SIGNATORY ARE COMPLETED & PAPERWORK<br/>
					IS RETURNED IMMEDIATELY UPON DESPATCH</b>
				</td>
			 </tr>
			
			</table>
		</td>
	</tr>
	
	
	

	<tr valign='bottom'>
 		<td colspan='6' align='center' class='small'>
			".COMPANY_REGISTERED_ADDRESS."&nbsp;".VAT_NUMBER."
		</td>
    </tr>
	
</table>";

?>